package com.protocolterminal.AFN.entity;

import java.util.List;

import com.protocolterminal.function.FrameFunction;

public class AFN04F1 implements Interface_Data {

	@Override
	public String frametolist(String frame) throws Exception {
		return null;
	}

	@Override
	public String listtoframe(List<String> datalist) throws Exception {
		if (datalist.size() != 8) {
			return "";
		}

		String data = "";

		data += Integer.toHexString(Integer.valueOf(datalist.get(0)) | 0x100).substring(1);
		data += Integer.toHexString(Integer.valueOf(datalist.get(1)) | 0x100).substring(1);

		String temp = "";
		temp = Integer.toHexString(Integer.valueOf(datalist.get(2)) | 0x1000).substring(1);
		temp = Integer.toHexString(Integer.valueOf(datalist.get(3))) + temp;
		FrameFunction frameFunction = new FrameFunction();
		data += frameFunction.Reverse(temp);

		data += Integer.toHexString((Integer.valueOf(datalist.get(4)) | (Integer.valueOf(datalist.get(5)) << 1)
				| (Integer.valueOf(datalist.get(6)) << 2)) | 0x100).substring(1);

		data += Integer.toHexString(Integer.valueOf(datalist.get(7)) | 0x100).substring(1);

		return data;

	}

}
